#include <iostream>
using namespace std;

int Fun(int num1, int num2);

int Fun(int num1, int num2)
{
    if(num2==0)
    {
        throw "除数不能为0";
    }
    return num1/num2;
}

int main()
{
    int num1, num2, result;
    while(1)
    {
        cout<<"请输入两个整数进行相除: "<<endl;
        cin>>num1;
        cin>>num2;

        // 用try-catch语句捕获异常
        try
        {
            result=Fun(num1, num2);
            cout<<"结果为: "<<result<<endl;
        }
        catch(const char* msg)
        {
            cout<<"异常: "<<msg<<endl;
            continue; // 继续下一次循环
        }

        break;
    }

    return 0;
}